package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstUserWeeklyDao;
import com.financing.wap.dto.DstUserWeeklyDTO;
import com.financing.wap.service.IDstUserWeeklyService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_user_weekly  
 * 用户访问周报 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstUserWeeklyService")
public class DstUserWeeklyServiceImpl implements IDstUserWeeklyService{

	@Autowired
	private IDstUserWeeklyDao dstUserWeeklyDao;

	@Override
	public int insert(DstUserWeeklyDTO dstUserWeekly) throws SQLException {
		DTOdateSetUtil.setCreateInfo(dstUserWeekly);
		DTOdateSetUtil.setUpdateInfo(dstUserWeekly);
		dstUserWeekly.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstUserWeeklyDao.insert(dstUserWeekly);
	}

	@Override
	public void update(DstUserWeeklyDTO dstUserWeekly) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserWeekly);
		dstUserWeeklyDao.update(dstUserWeekly);
	}

	@Override
	public void updateForce(DstUserWeeklyDTO dstUserWeekly) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserWeekly);
		dstUserWeeklyDao.updateForce(dstUserWeekly);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstUserWeeklyDao.delete(id);
	}
	
	@Override
	public List<DstUserWeeklyDTO> queryList(DstUserWeeklyDTO dstUserWeekly) throws SQLException {
		return dstUserWeeklyDao.queryList(dstUserWeekly);
	}

	@Override
	public int queryListCount(DstUserWeeklyDTO dstUserWeekly) throws SQLException {
		return dstUserWeeklyDao.queryListCount(dstUserWeekly);
	}

	@Override
	public DstUserWeeklyDTO loadById(Integer id) throws SQLException {
		return dstUserWeeklyDao.loadById(id);
	}
 	@Override
	public DstUserWeeklyDTO queryListGetFirst(DstUserWeeklyDTO dstUserWeekly)
			throws SQLException {
		 List<DstUserWeeklyDTO> queryList = queryList(dstUserWeekly);
		 if(queryList==null||queryList.size()==0){
			 return new DstUserWeeklyDTO();
		 }
		 return queryList.get(0);
	}
}
